/*
 * @Author: 李小晴 2689279066@qq.com
 * @Date: 2022-06-09 09:32:15
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2025-02-25 18:21:04
 * @FilePath: \global-brain\global-brain-admin\src\api\admin\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { useAxios } from '@/hooks/web/useAxios'
const request = useAxios()
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()
// 获取当前用户信息
export const adminInfoApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminInfo',
      data: data
    }
  })
}

export const adminListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminList',
      data: data
    }
  })
}

export const adminAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminAdd',
      data: data
    }
  })
}

export const adminEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminEdit',
      data: data
    }
  })
}

export const adminDelApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDel',
      data: data
    }
  })
}

export const adminBatchDelApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminBatchDel',
      data: data
    }
  })
}

export const adminDeptListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDeptList',
      data: data
    }
  })
}

export const stateApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminDeactivate',
      data: data
    }
  })
}

export const adminEditPasswordApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'adminEditPassword',
      data: data
    }
  })
}

// 后台-统计
export const adminStatisticsApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminStatistics',
      data: data
    }
  })
}
